import {createStore} from 'redux'

let initState = {
    // 促销列表
    saleList:[],
    activeList:[],
    name:'',
    type:'0000',
    startTime:'',
    endTime:''
   

}

let reducer = (state,actions) =>{

    if(actions.type === "SET_SALELIST"){
        state.saleList = [...actions.list]
    }

    // 促销列表
    if(actions.type === "SET_ACTIVELIST"){
        state.activeList = [...actions.list]
    }

    // 更改活动名字
    if(actions.type === "SET_NAME"){
        state.name = actions.name
    }
     // 更改活动类型
     if(actions.type === "SET_TYPE"){

        state.type = actions.value
    }
      // 更改活动日期
      if(actions.type === "SET_TIME"){

        state.startTime= actions.start
        state.endTime= actions.end
    }


    return {...state}
}
let store = createStore(reducer,initState)

export default store